<?php
/**
 * Show
 * Created by Veyron
 * motto:现在的拼搏 为了更好的明天
 * day:  2020/3/22
 * Time: 18:13
 */

namespace app\common\lib;

class Show
{
    /**
     * @param array $data
     * @param string $message
     * @return \think\response\Json
     */
    public static function success($data = [],$message = 'OK'){
        $result = [
            'status'  => config('status.success'),
            'message' => $message,
            'result'    => $data
        ];

        return json($result);
    }

    /**
     * @param array $data
     * @param string $message
     * @param $status
     * @return \think\response\Json
     */
    public static function error($message = 'error', $status = 0, $data = []){
        $result = [
            'status'  => $status,
            'message' => $message,
            'result'  => $data
        ];

        return json($result);
    }
}
